package com.lagou.task13;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleDateFormatTest {
    public static void main(String[] args) throws ParseException {
        Date d1 = new Date();
        System.out.println(d1);

        SimpleDateFormat sddf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //alt + enter 自动生成返回值
        String format = sddf.format(d1);
        System.out.println(format);

        Date date = sddf.parse(format);
        System.out.println(date);

    }
}
